<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ include file="/common/common.jsp"%>
<%
String path = request.getContextPath();
int currYear = Integer.valueOf(request.getAttribute("year").toString());
String currMonth = request.getAttribute("month").toString();
%>
<html>
	<head> 
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
		<script type="text/javascript" src="<%=path %>/js/highcharts-2.1/js/highcharts.js"></script> 
        <script type="text/javascript"> 
			var chart;
			$(document).ready(function() {
	    		//$('#year').combobox();
	    		//$('#month').combobox();
			    $('#year').val('<%=currYear%>');
    		    $('#month').val('<%=currMonth%>');
    		    $('#menuId').combotree({
				    url:'<%=path%>/sys/menu/SysMenu_searchMenuJsonTree.action',  //获取json格式的节点树
				    //打开节点时的操作
		            onClick:function (node){ 
		               	if($('#menuId').tree('isLeaf',node.target))
			                $.messager.alert('消息提示','请不要选中子节点菜单查询，否则将查询不到数据！','error');    	      	      
		            }
				});
    		    $('#menuId').combotree("setValue",'<%=request.getAttribute("menuId").toString() %>');
			    
			    <%if(!"".equals(request.getAttribute("menuName").toString())){ %>
				chart = new Highcharts.Chart({
					chart: {
						renderTo: 'container',
						defaultSeriesType: 'column',
						margin: [ 50, 50, 100, 80]
					},
					title: {
						text: '<%=currYear%>年<%=currMonth %>月各菜单访问量统计'
					},
					xAxis: {
						categories: [
							<%=request.getAttribute("menuName") %>
						],
						labels: {
							rotation: -45,
							align: 'right',
							style: {
								 font: 'normal 13px Verdana, sans-serif'
							}
						}
					},
					yAxis: {
						min: 0,
						title: {
							text: '访问次数(次)'
						}
					},
					legend: {
						enabled: false
					},
					tooltip: {
						formatter: function() {
							return '<b>'+ this.x +'</b><br/>'+
								 '<%=currYear%>年<%=currMonth %>月访问次数: '+ Highcharts.numberFormat(this.y, 1) +
								 ' 次';
						}
					},
				        series: [{
						name: '菜单名称',
						data: [<%=request.getAttribute("menuCnt") %>],
						dataLabels: {
							enabled: true,
							rotation: -90,
							color: '#FFFFFF',
							align: 'right',
							x: -3,
							y: 10,
							formatter: function() {
								return this.y;
							},
							style: {
								font: 'normal 13px Verdana, sans-serif'
							}
						}			
					}]
				});
				<%}%>
			$('#search').click(function(){
				document.forms[0].submit();
            });	
				
			});
				
		</script> 
		
	</head> 
	<body> 
	 <form action="<%=path %>/sys/log/SysUserOperateLog.action?type=static" method="post">
	   所属年份：<select type="text" id="year" name="year" style="width:60px">
       <% for(int i=new Date().getYear()+1900;i>=new Date().getYear()+1900-2;i--){ %>
       <option value="<%=i %>"><%=i %></option>
       <%} %>
       </select>
       所属月份：<select type="text" id="month" name="month" style="width:60px">
       <option value="01">1</option>
       <option value="02">2</option>
       <option value="03">3</option>
       <option value="04">4</option>
       <option value="05">5</option>
       <option value="06">6</option>
       <option value="07">7</option>
       <option value="08">8</option>
       <option value="09">9</option>
       <option value="10">10</option>
       <option value="11">11</option>
       <option value="12">12</option>
       </select>
       菜单模块：<select id="menuId" name="menuId" style="width:200px;"></select>（请选择非子菜单进行操作）
       
       <a id="search"  href="javascript:void(0)"  class="easyui-linkbutton" iconCls="icon-search">统计</a>
      </form> 
		<%if("".equals(request.getAttribute("menuName").toString())){ %>
		<font color="red">无法获得您要查询的日志信息，无法生成统计图，请选择其他查询条件！</font>
		<%}else{ %>
		<div id="container" style="width: 100%; height: 400px; margin: 0 auto"></div>
		<%} %> 
	</body> 
</html> 